package com.guigu.www.erp.yinjiaxiong.service.impl;

import com.guigu.www.erp.dengtao.dao.SCellMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import com.guigu.www.erp.common.pojo.PageVo;
import com.guigu.www.erp.common.pojo.SCell;
import com.guigu.www.erp.dengtao.dao.SCellMapper;
import com.guigu.www.erp.yinjiaxiong.service.YJXSCellService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class YJXSCellServiceImpl implements YJXSCellService {
    @Autowired
    SCellMapper sCellMapper;
    @Override
    public Integer ByProduceIdquerysCellCurrentcAmount(String produceId) {
        return sCellMapper.ByProduceIdquerysCellCurrentcAmount(produceId);
    }

    @Override
    public int addAmount(Integer addAmount,String productId) {
        return sCellMapper.addAmount(addAmount,productId);
    }

    @Override
    public PageVo<SCell> getAllSCell(SCell sCell, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<SCell> list = sCellMapper.getAllSCell(sCell);
        PageInfo<SCell> pageInfo = new PageInfo<>(list);
        PageVo<SCell> pageVo = new PageVo<>();
        pageVo.setTotal(pageInfo.getTotal());
        pageVo.setRows(pageInfo.getList());
        //System.out.println("pageVo----------"+pageVo);
        return pageVo;
    }

    @Override
    public Integer querySpaysCellCurrentAmount(String productId) {
        return sCellMapper.querySpaysCellCurrentAmount(productId);
    }

    @Override
    public String byProductIdqueryChecktag(String productId) {
        return sCellMapper.byProductIdqueryChecktag(productId);
    }
}
